package com.ruoyi.spi.service.fileupload.impl;

import com.ruoyi.spi.service.upload.IFileUpload;
import com.ruoyi.spi.service.fileupload.IFileUploadService;
import org.springframework.stereotype.Service;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * @author twlight
 * @since V1.0
 */
@Service
public class FileUploadServiceImpl implements IFileUploadService {

    public Object upload(int file){
        ServiceLoader<IFileUpload> loader = ServiceLoader.load(IFileUpload.class);
        Iterator<IFileUpload> iterator = loader.iterator();
        while (iterator.hasNext()) {
            return iterator.next().upload(file);
        }

        return null;
    }
}
